define(['jquery'], function($) {
	return function() {
		var userName = document.getElementById("userName");
		var spanName = document.getElementById("spanName");
		var password = document.getElementById("Pwd");
		var spanPassword = document.getElementById("spanPwd");
		userName.onblur = function() {
			var nameValue = userName.value;
			var pattern = /^[a-zA-Z][a-zA-Z0-9]{3,15}$/;
			if(nameValue == "" || nameValue == null) {
				spanName.innerHTML = "用户名不能为空!";
			} else if(pattern.test(nameValue)) {
				spanName.innerHTML = "正确!";
			} else {
				spanName.innerHTML = "用户名由字母开头和数字组成的4-16位字符!";
			}
		}
		password.onblur = function() {
			var passValue = password.value;
			var pattern = /^[a-zA-Z0-9]{4,10}$/;
			if(pattern.test(passValue)) {
				spanPassword.innerHTML = "";
			} else if(passValue == "" || passValue == null) {
				spanPassword.innerHTML = "密码不能为空!";
			} else {
				spanPassword.innerHTML = "密码不能含有非法字符，长度在4-10之间!";
			}
		}
	}
})